package com.cpr.demo.datasourcectl;

/**
 * @author Chen Panrui
 * created at 2022/3/17 18:43
 */
public class DataSourceTypeManager {

    private static final ThreadLocal<DataSources> DATA_SOURCE_TYPES = ThreadLocal.withInitial(() -> DataSources.DB_0);

    public static DataSources get(){
        return DATA_SOURCE_TYPES.get();
    }

    public static void set(DataSources dataSourceType){
        DATA_SOURCE_TYPES.set(dataSourceType);
    }

    public static void reset(){
        DATA_SOURCE_TYPES.set(DataSources.DB_0);
    }

    public static void remove(){
        DATA_SOURCE_TYPES.remove();
    }

}
